<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>迭代数组中的元素</title>
</head>
<body>
    <script>
         var arrs = ['a','b','c','d'];
          //1 传统的for循环
          let len = arrs.length;
          for(var i = 0;i<len;i++){
            console.log(arrs[i]);
          }
          //2 for...in
          for (index in arrs) {
            console.log(arrs[index]);
          }
          //3 for...of
          for(item of arrs){
            console.log(item);
          }
          //4 forEach
          arrs.forEach((item,index)=>{
            console.log(item,index);
          });
    </script>
</body>
</html>